package cn.dujc.superkid.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by kasumi on 2018/8/20.
 */

public class DateUtil {
    /**
     * 时间戳转字符串
     * long time = Long.valueOf(item.getKstime()).longValue();
     * String date2 = DateUtil.formatData("yyyy-MM-dd HH:mm:ss", time);
     * helper.setText(R.id.exam_data, date2);
     * */
    public static String formatData(String dataFormat, long timeStamp) {
        if (timeStamp == 0) {
            return "";
        }
        timeStamp = timeStamp * 1000;
        String result;
        SimpleDateFormat format = new SimpleDateFormat(dataFormat);
        result = format.format(new Date(timeStamp));
        return result;
    }
}